<template>
	<view>
		<view @click="langboxStatus=true">切换语言:{{$t('common.lang_select')}}</view>
		<u-popup :show="langboxStatus" mode="center" @close="langboxStatus=false" round="10">
			 <view class="selectlanguage">
				 <view class="u-padding-10" @click="setLang('chs')">{{$t('common.lang_cn')}}</view>
				 <u-gap height="10"></u-gap>
				 <view  class="u-padding-10" @click="setLang('enu')">{{$t('common.lang_en')}}</view>
			 </view>
		</u-popup>
	</view>
</template>

<script>
    import {
    	mapState,
    	mapMutations
    } from 'vuex';
	export default {
		props: {},
		data() {
			return {
				langboxStatus:false
			};
		},
		created(){

		},
		methods:{
		setLang(item){
			console.log("fasfsdf");
				 this.$i18n.locale = item;
				 uni.setStorageSync('locale',item)
				 this.langboxStatus=!this.langboxStatus;
				const lang = this.$i18n.locale;
				
				uni.setTabBarItem({
					index: 0,
					text: this.$t('tabBar.tab0'),
				});
				uni.setTabBarItem({
					index: 1,
					text: this.$t('tabBar.tab1'),
				});	 
				uni.setTabBarItem({
					index: 2,
					text: this.$t('tabBar.tab2'),
				});
				uni.setTabBarItem({
					index: 3,
					text: this.$t('tabBar.tab3'),
				});
				
					setTimeout(()=>{
						this.$tools.goJump('/pages/index/index',{},'','launch')
					},500)
			},
	}
}
</script>

<style lang="scss">
	.selectlanguage{
		padding: 20px;
	}
</style>
